package com.yantong.constant;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author kanghaixin
 * @date 2018/9/4.19:30
 */
public enum WorkOrderStatus {
    closed(-1, "关闭工单"),
    untreated(0, "未处理"),
    financeDeal(1, "财务处理"),
    over(2, "已完成");

    private int code;
    private String desc;

    public static List<Map<String,Object>> getWorkOrderStausList() {
        List<Map<String,Object>> list = new ArrayList<>();
        for (WorkOrderStatus status: WorkOrderStatus.values()) {
            Map<String,Object> item = new HashMap<>(2);
            item.put("desc", status.getDesc());
            item.put("code", status.getCode());
            list.add(item);
        }
        return list;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    WorkOrderStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
